package com.lry.jvm.classfile.constantpool;

import com.lry.jvm.classfile.ClassReader;

public class ConstantMethodHandleInfo implements ConstantInfo{

    private ConstantPool cp;
    private int refKind;
    private int refIndex;

    public ConstantMethodHandleInfo(ConstantPool cp, ClassReader reader){
        this.cp = cp;
        refKind = reader.nextU1ToInt();
        refIndex = reader.nextU2ToInt();
    }

    public String getValue() {
        return this.cp.getUTF8(this.refIndex);
    }

    @Override
    public String toString() {
        return this.cp.getUTF8(this.refIndex);
    }
}
